#include "vector.h"
#include <iostream.h>
vector::vector() {
n=0;
}

void vector::citire() {
cout<<"Dati n:";cin>>n;
cout<<"Dati elementele:"<<endl;
for (int i=0;i<n;i  ) cin>>elem[i];
}

void vector::afis() {
cout<<"Vectorul este"<<endl;
for (int i=0;i<n;i  ) cout<<elem[i]<<" ";
cout<<endl;
}



vector vector::ordonare(vector a,int k) {
v=a.getn();
int i,j;
for i=0;i<n;i++)
{
while (n!=k && k>0 && k<=n)
{
// Ordonoare descrescatoare
for (i=0; i<n-1; i++)
for (j=i+1; j<n; j++)
{
if (v[i] < v[j])
{
t = v[i];
v[i] = v[j];
v[j] = t;
}
}
// Ordonoare crescatoare
for (i=0; i<n-1; i++)
for (j=i+1; j<n; j++)
{
t = v[i];
v[i] = v[j];
v[j] = t;
}
}
}


int vector::getn() {
return n;
}

void vector::setn(int nr) {
n=nr;
}